/*
 * @Description:
 * @Version: 1.0
 * @Autor: chen_yt
 * @Date: 2022-06-14 11:13:30
 * @LastEditors: chen_yt
 * @LastEditTime: 2022-06-14 11:15:56
 */
import { getTs } from '@/api/app'
import storage from '../storage'
import dayjs from 'dayjs'

const setTs = () => {
    return new Promise((resolve) => {
        getTs().then((res) => {
            if (res && !isNaN(res)) {
                storage.set('ts-D-value', res - dayjs().unix())
            } else {
                storage.set('ts-D-value', 0)
            }
            resolve(true)
        }).catch(() => {
            resolve(true)
        })
    })
}

export {
    setTs
}
